/**
 * 机器码获取接口测试用例
 *
 * Created by snowingsea on 2020/02/25.
 */
const chai = require('chai');
const should = chai.should(); // eslint-disable-line no-unused-vars
chai.use(require('chai-http'));

const common = require('./../../common');
const Administrator = require('./../../../models/administrator');
const uri = require('./../uri');

module.exports = describe('/GET machine/code.json', function () {
  const administrator = new Administrator();
  const url = '/machine/code.json';

  common.should.be.user(uri, url, 'get');
  common.should.be.administrator(uri, url, 'get');

  // 正常请求
  it('it should GET machine code', function (done) {
    administrator.login()
      .then(() => {
        chai.request(uri)
          .get(url)
          .set('Authorization', `Bearer ${administrator.token.accessToken}`)
          .end((err, res) => {
            res.should.have.status(200);
            common.should.be.machineCodeMessage(res.body);
            done();
          });
      })
      .catch(done);
  });
});
